import { computed } from 'vue'
import type { TableColumnsType } from 'ant-design-vue'
import type { ExtendedDept } from '@/types/api/system/dept'

/**
 * 获取表格列配置
 * @param handlers 行操作的回调函数集合
 * @returns 表格列配置数组
 */
export const useTableColumns = () => {
  const { t } = useI18n()

  return computed<TableColumnsType<ExtendedDept>>(() => [
    {
      title: t('dept.name'),
      dataIndex: 'name',
      width: 150,
      ellipsis: true
    },
    {
      title: t('dept.leader'),
      dataIndex: 'leader',
      width: 100,
      ellipsis: true
    },
    {
      title: t('dept.phone'),
      dataIndex: 'phone',
      width: 120,
      ellipsis: true
    },
    {
      title: t('dept.email'),
      dataIndex: 'email',
      width: 200,
      ellipsis: true
    },
    {
      title: t('dept.orderNum'),
      dataIndex: 'orderNum',
      width: 80,
      align: 'center'
    },
    {
      title: t('dept.status'),
      key: 'status',
      width: 80,
      align: 'center'
    },
    {
      title: t('dept.createTime'),
      dataIndex: 'createTime',
      width: 160,
      ellipsis: true
    },
    {
      title: t('common.action'),
      key: 'action',
      width: 280,
      fixed: 'right',
      align: 'center'
    }
  ])
} 